import React from 'react';
import { Layout, Menu } from 'antd';
import { useNavigate, useLocation } from 'react-router-dom';
import {
  HomeOutlined,
  FileWordOutlined,
  FilePdfOutlined,
  ScanOutlined,
  SwapOutlined,
  MergeCellsOutlined,
  ScissorOutlined
} from '@ant-design/icons';
import styles from './Sidebar.module.css';

const { Sider } = Layout;

const Sidebar: React.FC = () => {
  const navigate = useNavigate();
  const location = useLocation();

  const menuItems = [
    {
      key: '/',
      icon: <HomeOutlined />,
      label: '首页'
    },
    {
      key: '/pdf-to-word',
      icon: <FileWordOutlined />,
      label: 'PDF转Word'
    },
    {
      key: '/pdf-to-ppt',
      icon: <SwapOutlined />,
      label: 'PDF转PPT'
    },
    {
      key: '/images-to-pdf',
      icon: <FilePdfOutlined />,
      label: '图片转PDF'
    },
    {
      key: '/ocr',
      icon: <ScanOutlined />,
      label: 'OCR识别'
    },
    {
      key: '/merge-pdf',
      icon: <MergeCellsOutlined />,
      label: '合并PDF'
    },
    {
      key: '/split-pdf',
      icon: <ScissorOutlined />,
      label: '分割PDF'
    }
  ];

  return (
    <Sider
      className={styles.sidebar}
      width={200}
      theme="dark"
    >
      <div className={styles.logo}>PDF工具箱</div>
      <Menu
        mode="inline"
        selectedKeys={[location.pathname]}
        defaultSelectedKeys={['/']}
        items={menuItems}
        onClick={({ key }) => navigate(key)}
        theme="dark"
      />
    </Sider>
  );
};

export default Sidebar; 